package com.soft.javase.ch02.test05;

/**
 * @author wangzhisen
 * @Desc TODO
 * @date 2025/4/18
 */
public class TestGame {
    public static void main(String[] args) throws InterruptedException {
        Monster monster = new Monster("哥斯拉" , 9 , 2000 , "兽类" , 300 , 200);
        monster.show();

        Hero hero = new Hero("英雄甲"  , 7 , 1500 , "人类" , 150 , 30);
        Equip e1 = new Equip("短刀" , 5 , "银色" , "刀具" , 100 , 30);
        Equip e2 = new Equip("长剑" , 6 , "金色" , "剑类" , 120 , 20);
        Equip e3 = new Equip("盾牌" , 3 , "银色" , "盾" , 30 , 120);
        Equip e4 = new Equip("屠龙刀" , 9 , "金色" , "刀具" , 1000 , 1200);
        hero.addEquip(e1);
        hero.addEquip(e2);
        hero.addEquip(e3);
        hero.addEquip(e4);
        hero.show();

        System.out.println("-------------- 回合制攻击 ------------");
        int count = 0;
        while (true){
            System.out.println("-------------- 第"+(++count)+"回合 ------------");
            //先英雄攻击怪兽
            hero.attack(monster);
            if(monster.isDead()){
                System.out.println("怪兽已死亡，游戏结束");
                break;
            }
            Thread.sleep(1000);

            //在怪兽攻击英雄
            monster.attack(hero);
            if(hero.isDead()){
                System.out.println("英雄已死亡，游戏结束");
                break;
            }
            Thread.sleep(1000);
        }
    }
}

